<?php
namespace app\admin\controller;

\think\Loader::import('controller/Controller', \think\Config::get('traits_path') , EXT);

use app\admin\Controller;
use think\Db;
class PaperType extends Controller
{
    use \app\admin\traits\controller\Controller;
    // 方法黑名单
    protected static $blacklist = [];

    /**
     * 首页
     * @return mixed
     */
    public function index()
    {
        $data=input();
        if($this::$isdelete){
            $map['pt.isdelete']=1;
        }else{
            $map['pt.isdelete']=0;
        }
        $listRows = $this->request->param('numPerPage') ? : config("paginate.list_rows");
        $list = Db::name('PaperType')
            ->alias('pt')
            ->join('driver_rank r', 'pt.rank_id=r.id', 'left')
            ->where($map)
            ->field('r.*,pt.*')
            ->paginate($listRows, false, ['query' => $this->request->get()]);

        $this->view->assign('list',$list);
        $this->view->assign("count", $list->total());
        $this->view->assign("page", $list->render());
        $this->view->assign('numPerPage', $list->listRows());
        return $this->view->fetch();
    }

    /**
     * 添加前获取等级列表
     * @return mixed
     */
    public function beforeadd()
    {            //获取等级列表
        $rank_list = get_ranks();

        $this->view->assign('rank_list',$rank_list);
    }

    /**
     * 编辑前获取等级列表
     * @return mixed
     */
    public function beforeedit()
    {            //获取等级列表
        $rank_list = get_ranks();

        $this->view->assign('rank_list',$rank_list);
    }
}
